#!/usr/bin/python
# -*- coding: GBK -*-
# MessageBox
# author: Hyx
# date: 2013-04-03
#--------------------------------------------------------------
## BoxType
MB_OK = 0
MB_OKCANCEL = 1
MB_ABORTRETRYIGNORE = 2
MB_YESNOCANCEL = 3
MB_YESNO = 4
MB_RETRYCANCEL = 5
MB_ICONHAND = 16
MB_ICONQUESTION = 32
MB_ICONEXCLAMATION = 48
MB_ICONASTERISK = 64


def LoadLibraryEx(dllName):
    '''DLL load, return the handle of the dll or None'''
    from ctypes import windll
    try:
        return windll.LoadLibrary(dllName)
    except WindowsError:
        return None
    return None


def MessageBox(title, msg, stype):
    hd = LoadLibraryEx("user32.dll")
    if hd is not None:
        hd.MessageBoxA(0, msg, title, stype)


def test():
    MessageBox("Warn", "HelloWorld", MB_OKCANCEL)


if __name__ == '__main__':
    test()